home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / nasm095s.zip / MACROS.PL < prev    next >
Perl Script  |  1997-07-27  |  899b  |  28 lines

  1. #!/usr/bin/perl
  2. #
  3. # macros.pl   produce macros.c from standard.mac
  4. #
  5. # The Netwide Assembler is copyright (C) 1996 Simon Tatham and
  6. # Julian Hall. All rights reserved. The software is
  7. # redistributable under the licence given in the file "Licence"
  8. # distributed in the NASM archive.
  9.  
  10. open INPUT,"standard.mac" || die "unable to open standard.mac\n";
  11. open OUTPUT,">macros.c" || die "unable to open macros.c\n";
  12.  
  13. print OUTPUT "/* This file auto-generated from standard.mac by macros.pl" .
  14.         " - don't edit it */\n\nstatic char *stdmac[] = {\n";
  15.  
  16. while (<INPUT>) {
  17.   chomp;
  18.   # this regexp ought to match anything at all, so why bother with
  19.   # a sensible error message ;-)
  20.   die "swirly thing alert" unless /^\s*((\s*([^"';\s]+|"[^"]*"|'[^']*'))*)/;
  21.   $_ = $1;
  22.   s/\\/\\\\/g;
  23.   s/"/\\"/g;
  24.   print OUTPUT "    \"$_\",\n" if length > 0;
  25. }
  26.  
  27. print OUTPUT "    NULL\n};\n"
  28.